/**
 * Created by 都大爽 on 2017/10/20.
 */

export default {

  /**
   * get province list for select.
   *
   * @param params
   * @param cb
   */
  getProvinceList(params = {}, cb = function () {
  }){
    axios.get('/api/data/province-list', {
      params: params
    }).then(function (response) {
      cb(response.data.data);
    });
  },

  /**
   * get city list for select by province id.
   *
   * @param provinceId
   * @param params
   * @param cb
   */
  getCityList(provinceId, params = {}, cb = function () {
  }){
    if (provinceId > 0) {
      axios.get('/api/data/city-list/' + provinceId, {params: params}).then(function (response) {
        cb(response.data.data);
      });
    } else {
      cb([]);
    }
  },

  /**
   * get school list for select by city id.
   *
   * @param cityId
   * @param params
   * @param cb
   */
  getSchoolList(cityId, params = {}, cb = function () {
  }){
    if (cityId > 0) {
      axios.get('/api/data/school-list/' + cityId, {params: params}).then(function (response) {
        cb(response.data.data);
      });
    } else {
      cb([]);
    }
  },

  /**
   * 获取学校数据
   * @param params
   * @param cb
   */
  getSchoolAllList(params = {}, cb = function () {
  }){
    axios.get('/api/data/school-all-list', {params: params}).then(function (response) {
      cb(response.data.data)
    })
  },

  /**
   * get dept list for select by school id.
   *
   * @param schoolId
   * @param params
   * @param cb
   */
  getDeptList(schoolId, params = {}, cb = function () {
  }){
    if (schoolId > 0) {
      axios.get('/api/data/dept-list/' + schoolId, {params: params}).then(function (response) {
        cb(response.data.data);
      });
    } else {
      cb([]);
    }
  },

  /**
   * get speciality list for select by dept id.
   *
   * @param deptId
   * @param params
   * @param cb
   */
  getSpecialityList(deptId, params = {}, cb = function () {
  }){
    if (deptId > 0) {
      axios.get('/api/data/speciality-list/' + deptId, {params: params}).then(function (response) {
        cb(response.data.data);
      });
    } else {
      cb([]);
    }
  },

  /**
   * get position title list for select.
   *
   * @param params
   * @param cb
   */
  getPositionTitleList(params = {}, cb = function () {
  }){
    axios.get('/api/data/position-title-list', {params: params}).then(function (response) {
      cb(response.data);
    });
  },

  /**
   * get award list for select.
   *
   * @param params
   * @param cb
   */
  getAwardList(params = {}, cb = function () {
  }){
    axios.get('/api/data/award-list', {params: params}).then(function (response) {
      cb(response.data.data);
    });
  },

  /**
   * get proposition list for select.
   *
   * @param params
   * @param cb
   */
  getPropositionList(params = {}, cb = function () {
  }){
    axios.get('/api/data/proposition-list', {params: params}).then(function (response) {
      cb(response.data.data);
    });
  },

  /**
   * get works type list for select.
   *
   * @param params
   * @param cb
   */
  getWorksTypeList(params = {}, cb = function () {
  }){
    axios.get('/api/data/works-type-list', {params: params}).then(function (response) {
      cb(response.data.data);
    });
  },

  /**
   * get vote award list for select.
   *
   * @param params
   * @param cb
   */
  getVoteAwardList(params = {}, cb = function () {
  }){
    axios.get('/api/data/vote-award-list', {params: params}).then(function (response) {
      cb(response.data.data);
    });
  },

  /**
   *
   * @param params
   * @param cb
   */
  getTemplet(params = {}, cb = function () {
  }){
    axios.get('/api/data/templet').then(function (response) {
      cb(response.data.data);
    });
  },

  /**
   *
   * @param params
   * @param cb
   */
  getUploadExts(params = {}, cb = function () {
  }){
    axios.get('/api/data/upload-exts').then(function (response) {
      cb(response.data);
    });
  },
}

